﻿@model IEnumerable<Project_KhuyenMaiVang.Models.TinKhuyenMaiDTO>

@{
    ViewBag.Title = "QuanLyTinKhuyenMai";
    Layout = "~/Views/Shared/_LayoutAdmin.cshtml";
    List<Project_KhuyenMaiVang.Models.SanPhamDTO> DsSanPham = ViewBag.SanPhamList;
}

<h2>Quản Lý Tin Khuyến Mãi</h2>

<table id = "myTable" border = "1">
    <thead>
    <tr>
        <th>Sản Phẩm</th>
        <th>Tóm tắt</th>
        <th>Tình Trạng</th>
        <th>Giá</th>
        <th>Thao Tác</th>
    </tr>
    </thead>
@for (int i = 0; i < Model.Count(); i++)
{
    <tr>
        <td>@Html.ActionLink(DsSanPham.ElementAt(i).TenSanPham.ToString(), "XemChiTietSanPham", "Admin", new { idSanPham = Model.ElementAt(i).MaSanPham }, null)</td>
        <td>@Html.Label(Model.ElementAt(i).ThongTinTomTat)</td>
        @{
            var tinhTrang = "";
            if (Model.ElementAt(i).TinhTrang)
            {
                tinhTrang = "Hiện";
            }
            else
            {
                tinhTrang = "Ẩn";
            }
        <td>@tinhTrang</td>
            }
        <td>@Html.Label(Model.ElementAt(i).GiaKhuyenMai.ToString())</td>
        <td>@Html.ActionLink("Cập Nhật", "EditTinKhuyenMai", "Admin", new {id = Model.ElementAt(i).MaTinKhuyenMai}, null)</td>

    </tr>
}

</table>

<script src="../../Scripts/jquery-1.5.1.min.js" type="text/javascript"></script>
<script src="../../Scripts/jquery.tablesorter.js" type="text/javascript"></script>
<script src="../../Scripts/jquery.tablesorter.pager.js" type="text/javascript"></script>
<script type="text/javascript">
    $(document).ready(function () {
        $("#myTable").tablesorter();
        $("#myTable").hide();
        $("#myTable").toggle(500);
    }
); 
</script>